﻿// <copyright file="IGraph.cs" company="Alan Dean">
// The MIT License

// Copyright (c) 2008 Alan Dean

// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:

// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.

// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
// </copyright>
// <author>Alan Dean</author>
// <email>alan.dean@thoughtpad.net</email>

namespace Semantic.Collections.Generic
{
    using System;
    using System.Collections.Generic;
    using System.Diagnostics.CodeAnalysis;

    using Semantic.Rdf;

    /// <summary>Defines the RDF graph interface.</summary>
    /// 
    /// <remarks>
    /// <para>An RDF graph is a set of RDF triples.</para>
    /// <para>
    /// The set of nodes  of an RDF graph is the set of subjects and objects of triples in the graph.
    /// </para>
    /// </remarks>
    /// 
    /// <seealso href="http://www.w3.org/TR/rdf-concepts/#section-rdf-graph">RDF Graph</seealso>
    [SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix", Justification = "This is the correct name.")]
    public interface IGraph : ICollection<ITriple>
    {
        #region ITriple this[int]
        /// <summary>
        /// Gets or sets the element at the specified index.
        /// </summary>
        /// 
        /// <param name="index">
        /// The zero-based index of the element to get or set.
        /// </param>
        /// 
        /// <returns>The element at the specified index.</returns>
        /// 
        /// <exception cref="T:System.ArgumentOutOfRangeException">
        /// index is less than zero.<br/>-or-<br/>
        /// index is equal to or greater than <see cref="P:System.Collections.ObjectModel.Collection`1.Count"/>.
        /// </exception>
        ITriple this[int index]
        {
            get;
            set;
        }
        #endregion

        #region IGraph Select(IUriReference, IUriReference)
        /// <summary>
        /// Selects all triples from the current graph with matching
        /// <paramref name="subject"/> and <paramref name="predicate"/> values.
        /// </summary>
        /// 
        /// <param name="subject">The triple subject to match.</param>
        /// <param name="predicate">The triple predicate to match.</param>
        /// 
        /// <returns>
        /// An RDF <see cref="T:Semantic.Rdf.Graph"/> containing the selection results.
        /// </returns>
        [SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Select", Justification = "This is the correct name.")]
        IGraph Select(IUriReference subject, IUriReference predicate);
        #endregion
    }
}